package com.tiny.mirror.service.product.support.strategy.lhc;

import com.tiny.mirror.service.product.domain.ability.AbilityParams;
import com.tiny.mirror.service.product.domain.ability.LhcParams.LhcPlayParams;
import com.tiny.mirror.service.product.enums.AbilityLhcStrategyEnum;
import com.tiny.mirror.service.product.support.strategy.lhc.dto.LhcNumberDTO;
import java.math.BigDecimal;

public interface LhcStrategy {

  // 策略
  AbilityLhcStrategyEnum strategy();

  // 构建初始化数据
  LhcPlayParams build();

  // 获取返利金额
  BigDecimal getReward(LhcPlayParams lhcPlayParams, BigDecimal amount);

  // 计算结果,返回盈利
  BigDecimal calculate(
      LhcPlayParams lhcPlayParams, BigDecimal amount, LhcNumberDTO result, String... item
  );

  // 获取玩法参数
  default LhcPlayParams getParams(
      AbilityParams abilityParams, AbilityLhcStrategyEnum strategy
  ) {
    return abilityParams.getLhcParams().getPlayList().stream()
        .filter(l -> strategy.equals(l.getStrategy())).findFirst().get();
  }
}
